package com.pms.mapper;

import com.github.pagehelper.Page;
import com.pms.dto.PaymentPageQueryDTO;
import com.pms.entity.Payment;
import com.pms.vo.PaymentPageQueryVO;
import org.apache.ibatis.annotations.*;

@Mapper
public interface PaymentMapper {
    /**
     * 新增缴费信息
     * @param payment
     */
    @Insert("insert into payment(content, amount, owner_id, status_id, create_date) " +
            "values(#{content},#{amount},#{ownerId},#{statusId},#{createDate})")
    void save(Payment payment);

    /**
     * 缴费信息分页查询
     * @param paymentPageQueryDTO
     * @return
     */
    Page<PaymentPageQueryVO> page(PaymentPageQueryDTO paymentPageQueryDTO);

    /**
     * 根据id查询缴费信息
     * @param id
     * @return
     */
    @Select("select * from payment where id=#{id}")
    Payment getById(Integer id);

    /**
     * 根据id修改状态
     * @param payment
     */
    @Update("update payment set status_id=#{statusId} where id=#{id}")
    void update(Payment payment);

    /**
     * 删除缴费信息
     * @param id
     */
    @Delete("delete from payment where id=#{id}")
    void delete(Integer id);
}
